package com.hotel.hotelsystem.service.impl;

import com.hotel.hotelsystem.pojo.HotelListES;
import com.hotel.hotelsystem.service.EsHotelListService;
import com.hotel.hotelsystem.service.NoEsHotelListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

@Service
public class EsHotelListServiceImpl implements NoEsHotelListService {

    @Autowired
    private EsHotelListService esHotelListService;

    @Override
    public long selectByPageCount(Integer pageNum) {
        PageRequest page = PageRequest.of(pageNum, 8);
        Page<HotelListES> hotelListES = esHotelListService.findAll(page);
        System.out.println("====================统计数据");
        System.out.println("分页查询出来的数据"+hotelListES.stream().count());
        return hotelListES.stream().count();
    }


}
